FROM centos:latest
MAINTAINER Jeffrey <weiliu68@gmail.com>

RUN yum -y install openssh-server epel-release && \
    yum -y install pwgen && \
    rm -f /etc/ssh/ssh_host_ecdsa_key /etc/ssh/ssh_host_rsa_key && \
    ssh-keygen -q -N "" -t dsa -f /etc/ssh/ssh_host_ecdsa_key && \
    ssh-keygen -q -N "" -t rsa -f /etc/ssh/ssh_host_rsa_key && \
    sed -i "s/#UsePrivilegeSeparation.*/UsePrivilegeSeparation no/g" /etc/ssh/sshd_config && \
    sed -i "s/UsePAM.*/UsePAM yes/g" /etc/ssh/sshd_config

RUN yum install -y python-pip
RUN easy_install pip
RUN pip install shadowsocks

ADD set_root_pw.sh /set_root_pw.sh
ADD start_ssserver.sh /start_ssserver.sh
ADD run.sh /run.sh
RUN chmod +x /*.sh

ENV AUTHORIZED_KEYS **None**
ENV SS_PORT 566
ENV SS_METHOD rc4-md5

EXPOSE $SS_PORT
EXPOSE 8080
EXPOSE 22
CMD ["/run.sh"]
